#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char * argv[]) {

  const string DESC = "Make shortcut to file";
  const int SUBTYPE = 1;
  const int AUX = 0;
  
  if (argc < 1) {
    cout<<"Error: Must arguments";
    return 1;
  } else if (string(argv[1]) == "-h") {
    cout<<DESC;
  } else if (string(argv[1]) == "-t") {
    cout<<SUBTYPE;
  } else if (string(argv[1]) == "-x") {
    cout<<AUX;
  } else {
    string arg = string(argv[1]);
    if (arg.substr(arg.size()-1) == "/") arg = arg.substr(0, arg.size()-1);
    string target = "\"" + arg + "\"";
    string link = "\"" + arg.substr(0, arg.find_last_of("/")+1) + "shortcut to " + arg.substr(arg.find_last_of("/")+1) + "\"";
    #ifdef _WIN32
    string cmd = "mklink /D " + link + " " + target;
    #else
    string cmd = "ln -s " + target + " " + link;
    #endif
    system(cmd.c_str());
  }
  
  return 0;
}
